UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WfYfucw1rlhjWJM2wlYdK7PKus7T0KBHOhi8ce7iCfw=' 
WHERE 
  key_id = 'f974c601b8bbb12fc3947cba2be23033f61a396ab2131580caf729ecca253b96' 
  AND (
    token = 'WfYfucw1rlhjWJM2wlYdK7PKus7T0KBHOhi8ce7iCfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030