UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K//IfBfQiPAU09TLk2VZowJkARVuOJ9/BZU9WgpnZZY=' 
WHERE 
  key_id = '04a0fc3f2f7f01f90023ece4855babf80cd7abaaced1bc55a8f6d4b25e769e8b' 
  AND (
    token = 'K//IfBfQiPAU09TLk2VZowJkARVuOJ9/BZU9WgpnZZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052