UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ffhMmMnN7DHceqp8VbZ2TBBFlbZs0/kTTaSUGltSh1A=' 
WHERE 
  key_id = '727c09232e9d981342021c921ae85dc4745443a56a1de851958393397c5b9930' 
  AND (
    token = 'ffhMmMnN7DHceqp8VbZ2TBBFlbZs0/kTTaSUGltSh1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046