UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nk4YjwiE0ihbviR42E1mSsC+DOpT5NrvSxdk8Tmyhgw=' 
WHERE 
  key_id = '19af68ba22df95a54c0787b7580cf8a384cd268596a96b2b62d8d7805d31bb87' 
  AND (
    token = 'Nk4YjwiE0ihbviR42E1mSsC+DOpT5NrvSxdk8Tmyhgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023