UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TKv+mgZjLS5ufVA0BVL+lW+6i9GZx+P2wQPOJrST6y8=' 
WHERE 
  key_id = '8c7ee841f1e25dc2dd5522a7b0f42babfe3dd26de6f4b5b4fdf69bcf4cbf8464' 
  AND (
    token = 'TKv+mgZjLS5ufVA0BVL+lW+6i9GZx+P2wQPOJrST6y8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030