UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ufJMrLhHcrKV8l3EbPMcQu6n+17ZD+74ZTebCwKYGq8=' 
WHERE 
  key_id = '5e59533e099b230fc170eb1c2bca617ab39820990363f6f5d8e5af8fbe12e971' 
  AND (
    token = 'ufJMrLhHcrKV8l3EbPMcQu6n+17ZD+74ZTebCwKYGq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044