UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vdDJaFCu7iz0/25Y/jzcJhsA1FhDuiKhdijvzEvQ4f8=' 
WHERE 
  key_id = '9cb2e2888671d2fd06a416393f3f07ea4b8626608a9dfb1676504182315d19a7' 
  AND (
    token = 'vdDJaFCu7iz0/25Y/jzcJhsA1FhDuiKhdijvzEvQ4f8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036