UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'erGP8iSo0nRCQAsOKN94UTjcO/sK1oOH/23eH+J6DEY=' 
WHERE 
  key_id = '09ae1b3f0ae2024a01690289158a920670cc7b987b9c4a8637a93f3fc14441c8' 
  AND (
    token = 'erGP8iSo0nRCQAsOKN94UTjcO/sK1oOH/23eH+J6DEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037