UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l1lClD2xK6us30/oSH1jND48AEhriWUmBprwftToB1A=' 
WHERE 
  key_id = '825414d5d424e2edff775d3b9a4006432b318528c662e675a94875a622b34e22' 
  AND (
    token = 'l1lClD2xK6us30/oSH1jND48AEhriWUmBprwftToB1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036