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

Query time 0.00024