UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JLHLlwlziLI+f+s18SpQZRHTaLF/nDD4p6v41bHJQdc=' 
WHERE 
  key_id = '244d92fcfc09d5f303d769f14be4b01989b1c94d1a06e2308d4841c03ac82215' 
  AND (
    token = 'JLHLlwlziLI+f+s18SpQZRHTaLF/nDD4p6v41bHJQdc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023