UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X17q7zRFgLNVbregSw26Favgt5QrBZcZQGQrKSlxyHU=' 
WHERE 
  key_id = '8607be4bad74ff2822724c2f33a514138f9aaa32bca2aaaf9b3052c215a5b022' 
  AND (
    token = 'X17q7zRFgLNVbregSw26Favgt5QrBZcZQGQrKSlxyHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017