UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wwbkSN0Q0LUGElFoBC2jiaKiEwZvna+O3gZdEZsHcWw=' 
WHERE 
  key_id = '00d497d84929302ff1f37822292fbbe1320cf3845b5979ca1e8a6ad3a82d098d' 
  AND (
    token = 'wwbkSN0Q0LUGElFoBC2jiaKiEwZvna+O3gZdEZsHcWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042