UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zPXupmWeKE8Rt+qNOCzNZbOvoakRcu0Gas/D2qzHzDo=' 
WHERE 
  key_id = '05770e4b77b77982d7f6e5dd77896c04cdf3fbe5247f6d42db7cab296eadde2b' 
  AND (
    token = 'zPXupmWeKE8Rt+qNOCzNZbOvoakRcu0Gas/D2qzHzDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039