UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mN86MoYmC7PMkaOmBAKk/kFF+RMr2mfNiA1I5UO8hBw=' 
WHERE 
  key_id = 'd09836110b015da774e916d3db497a4d127e908664d243f801c869013aab6708' 
  AND (
    token = 'mN86MoYmC7PMkaOmBAKk/kFF+RMr2mfNiA1I5UO8hBw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021