UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lwartkNjPpEHSFDtlAn15wD9qii1T+U4zcV+bMrr0S8=' 
WHERE 
  key_id = '8faa3b9c7b0432120f383acd62371cced188d107fc88ac6d64538366f5ed7d98' 
  AND (
    token = 'lwartkNjPpEHSFDtlAn15wD9qii1T+U4zcV+bMrr0S8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034