UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hHns0kr+DCUUg/iMa/PG112QkXLzeuN9Y0jM8nXDhQ0=' 
WHERE 
  key_id = '9a39f2d4f2f965dfc9eee603f897fdf92e1bf1051a4b53cfb0f099af8437ef5a' 
  AND (
    token = 'hHns0kr+DCUUg/iMa/PG112QkXLzeuN9Y0jM8nXDhQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035