UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mFvBdf5GAp/xuGV4gZOo/Ia4K+va3p5RwFbWnHAaCwg=' 
WHERE 
  key_id = '97d04bc007fbf073e270b850422cafe720a0f5488d40999b9e8bee2070ba2a6b' 
  AND (
    token = 'mFvBdf5GAp/xuGV4gZOo/Ia4K+va3p5RwFbWnHAaCwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042