UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0II9APKRmdX0JjSa2dRlupRlNYNX20kmdl7QGQfq+CU=' 
WHERE 
  key_id = '48bea0394602fb5a493ce7176892f3a43e3c5a094e069308c3bf367c11c52864' 
  AND (
    token = '0II9APKRmdX0JjSa2dRlupRlNYNX20kmdl7QGQfq+CU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038