UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RsR91UtBFYIOyRsd2XJuQUH8oGztXhKYDLtktApWdEs=' 
WHERE 
  key_id = 'e4b4f78cbcede0ac5dd4a9051c166c26f62c92d97f95d1f9feb12c28574f848e' 
  AND (
    token = 'RsR91UtBFYIOyRsd2XJuQUH8oGztXhKYDLtktApWdEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029