UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bzJwgq+ZkEq5mstuiC9+BCzjiZMuly1SNpPXdKB0CJM=' 
WHERE 
  key_id = 'c89c4f585b817bbdf477a379a3604bdb541723217f05bb45ebe696aaaf67549f' 
  AND (
    token = 'bzJwgq+ZkEq5mstuiC9+BCzjiZMuly1SNpPXdKB0CJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030