UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gH2ST8ZqVCP+FbbiYGWIKGJhwZDGvwZV3A7kDFndrj0=' 
WHERE 
  key_id = '4192ca3f31e9fa4cf76546b7843e5c031a1024f08c0161fa5c674d8b8b096a51' 
  AND (
    token = 'gH2ST8ZqVCP+FbbiYGWIKGJhwZDGvwZV3A7kDFndrj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070