UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pKaiby1khpziOWfXAbfXMX/qz7YMJucLctGbN6dfuVc=' 
WHERE 
  key_id = '1977c7c8907de0f465090b18b48f898f0ec3ce50a17d99fabc12e55e1b004ecc' 
  AND (
    token = 'pKaiby1khpziOWfXAbfXMX/qz7YMJucLctGbN6dfuVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040