UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R+AmDvAY1V6yzOkF4qOsu9vVUxy0z+ISnlkx/H9BanE=' 
WHERE 
  key_id = 'b39d4e2c6000298a5feee756ac20497c8a59659a823ed90b9ab9ec28c4d6df51' 
  AND (
    token = 'R+AmDvAY1V6yzOkF4qOsu9vVUxy0z+ISnlkx/H9BanE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027