UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8Vnk9yDwMg+X98tAVDbH/xLg94aP6HEHaR58KUWuWo=' 
WHERE 
  key_id = '4060a32ffb8cd884bea0e3f7cc7e98003a93956512852964b3cde00ab6dd8a99' 
  AND (
    token = 'W8Vnk9yDwMg+X98tAVDbH/xLg94aP6HEHaR58KUWuWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017