UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DnMz4GBxDrQHJr8BPQgNup8PkNSAZrehEv6YU7/cXr0=' 
WHERE 
  key_id = 'd1ecd8595c166a2478e6933623afb24e28ab148d20453140c027f955fa5c5d14' 
  AND (
    token = 'DnMz4GBxDrQHJr8BPQgNup8PkNSAZrehEv6YU7/cXr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036