UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '17zSN7FeUyTQLRrNuWeH88tgxHTzg5OHm71H5o3rDCA=' 
WHERE 
  key_id = 'ab366b9cae70ceefdee5b9c536620519f8d545b917579e869400e591f119ccbf' 
  AND (
    token = '17zSN7FeUyTQLRrNuWeH88tgxHTzg5OHm71H5o3rDCA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031