UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I6TshfmZ1DP9eMnrICf1pD8lWKfhkFgjUXMvgFujZu8=' 
WHERE 
  key_id = '9c91d71f496e18290261748846ca766d3bf77143bbea5424dd054882feb09050' 
  AND (
    token = 'I6TshfmZ1DP9eMnrICf1pD8lWKfhkFgjUXMvgFujZu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068