UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QEyttfcdlz/awu46bDXMDPHYk95saoMtlIqdXAuRo6g=' 
WHERE 
  key_id = 'cd8b6682dda124052628f8deb35cb5d458b99f8d0162c6ffd9c1decafa14f29f' 
  AND (
    token = 'QEyttfcdlz/awu46bDXMDPHYk95saoMtlIqdXAuRo6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054