UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Vv1R9tGFXrMkGzKbdcbLcj4zPgeKfISRUOQtUjrWmg=' 
WHERE 
  key_id = '1ef4cdc991dcd8509e23dc189ae068bbf7368b88a5ecf22283596cc17a142815' 
  AND (
    token = '6Vv1R9tGFXrMkGzKbdcbLcj4zPgeKfISRUOQtUjrWmg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033